package ccapp.gui;

import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SpringLayout;

import frmsystem.gui.RegistrationUI;

public class CardRegistrationGUI extends RegistrationUI {
	
	private JRadioButton chkCopper;
	private JTextField txtCCNo;
	private JTextField txtExpDate;
	private JButton cmdOk;
	private JButton cmdCancel;
	
	public CardRegistrationGUI(){
		getContentPane().removeAll();
		layout = new SpringLayout();
		getContentPane().setLayout(layout);
    	chkCheckings = new JRadioButton("Gold");
    	btnGroup.add(chkCheckings);
    	getContentPane().add(chkCheckings);
    	layout.putConstraint(SpringLayout.WEST, chkCheckings, 10, SpringLayout.WEST, getContentPane());
    	layout.putConstraint(SpringLayout.NORTH, chkCheckings, 10, SpringLayout.NORTH, getContentPane());
    	
    	chkSavings = new JRadioButton("Silver");
    	btnGroup.add(chkSavings);
    	getContentPane().add(chkSavings);
    	layout.putConstraint(SpringLayout.WEST, chkSavings, 0, SpringLayout.WEST, chkCheckings);
    	layout.putConstraint(SpringLayout.NORTH, chkSavings, 10, SpringLayout.SOUTH, chkCheckings);
    	
    	chkCopper = new JRadioButton("Copper");
    	btnGroup.add(chkCopper);
    	getContentPane().add(chkCopper);
    	layout.putConstraint(SpringLayout.WEST, chkCopper, 0, SpringLayout.WEST, chkSavings);
    	layout.putConstraint(SpringLayout.NORTH, chkCopper, 10, SpringLayout.SOUTH, chkSavings);
    	
    	JLabel lblName = new JLabel("Name:");
    	getContentPane().add(lblName);
    	layout.putConstraint(SpringLayout.WEST, lblName, 0, SpringLayout.WEST, chkCopper);
        layout.putConstraint(SpringLayout.NORTH, lblName, 10, SpringLayout.SOUTH, chkCopper);
        
        txtName = new JTextField(10);
        getContentPane().add(txtName);
        layout.putConstraint(SpringLayout.WEST, txtName, 60, SpringLayout.EAST, lblName);
        layout.putConstraint(SpringLayout.NORTH, txtName, 0, SpringLayout.NORTH, lblName);
        
        JLabel lblStreet = new JLabel("Street:");
    	getContentPane().add(lblStreet);
    	layout.putConstraint(SpringLayout.WEST, lblStreet, 0, SpringLayout.WEST, lblName);
        layout.putConstraint(SpringLayout.NORTH, lblStreet, 10, SpringLayout.SOUTH, lblName);
        
        txtStreet = new JTextField(10);
        getContentPane().add(txtStreet);
        layout.putConstraint(SpringLayout.WEST, txtStreet, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtStreet, 0, SpringLayout.NORTH, lblStreet);
        
        JLabel lblCity = new JLabel("City:");
    	getContentPane().add(lblCity);
    	layout.putConstraint(SpringLayout.WEST, lblCity, 0, SpringLayout.WEST, lblStreet);
        layout.putConstraint(SpringLayout.NORTH, lblCity, 10, SpringLayout.SOUTH, lblStreet);
        
        txtCity = new JTextField(10);
        getContentPane().add(txtCity);
        layout.putConstraint(SpringLayout.WEST, txtCity, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtCity, 0, SpringLayout.NORTH, lblCity);
        
        JLabel lblState = new JLabel("State:");
    	getContentPane().add(lblState);
    	layout.putConstraint(SpringLayout.WEST, lblState, 0, SpringLayout.WEST, lblCity);
        layout.putConstraint(SpringLayout.NORTH, lblState, 10, SpringLayout.SOUTH, lblCity);
        
        txtState = new JTextField(10);
        getContentPane().add(txtState);
        layout.putConstraint(SpringLayout.WEST, txtState, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtState, 0, SpringLayout.NORTH, lblState);
        
        JLabel lblZip = new JLabel("Zip:");
    	getContentPane().add(lblZip);
    	layout.putConstraint(SpringLayout.WEST, lblZip, 0, SpringLayout.WEST, lblState);
        layout.putConstraint(SpringLayout.NORTH, lblZip, 10, SpringLayout.SOUTH, lblState);
        
        txtZip = new JTextField(10);
        getContentPane().add(txtZip);
        layout.putConstraint(SpringLayout.WEST, txtZip, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtZip, 0, SpringLayout.NORTH, lblZip);
        
        JLabel lblEmail = new JLabel("Email:");
    	getContentPane().add(lblEmail);
    	layout.putConstraint(SpringLayout.WEST, lblEmail, 0, SpringLayout.WEST, lblZip);
        layout.putConstraint(SpringLayout.NORTH, lblEmail, 10, SpringLayout.SOUTH, lblZip);
        
        txtEmail = new JTextField(10);
        getContentPane().add(txtEmail);
        layout.putConstraint(SpringLayout.WEST, txtEmail, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtEmail, 0, SpringLayout.NORTH, lblEmail);
        
        JLabel lblCCNo = new JLabel("CC Number:");
    	getContentPane().add(lblCCNo);
    	layout.putConstraint(SpringLayout.WEST, lblCCNo, 0, SpringLayout.WEST, lblEmail);
        layout.putConstraint(SpringLayout.NORTH, lblCCNo, 10, SpringLayout.SOUTH, lblEmail);
        
        txtCCNo = new JTextField(10);
        getContentPane().add(txtCCNo);
        layout.putConstraint(SpringLayout.WEST, txtCCNo, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtCCNo, 0, SpringLayout.NORTH, lblCCNo);
        
        JLabel lblExp = new JLabel("Exp. Date:");
    	getContentPane().add(lblExp);
    	layout.putConstraint(SpringLayout.WEST, lblExp, 0, SpringLayout.WEST, lblCCNo);
        layout.putConstraint(SpringLayout.NORTH, lblExp, 10, SpringLayout.SOUTH, lblCCNo);
        
        txtExpDate = new JTextField(10);
        getContentPane().add(txtExpDate);
        layout.putConstraint(SpringLayout.WEST, txtExpDate, 0, SpringLayout.WEST, txtName);
        layout.putConstraint(SpringLayout.NORTH, txtExpDate, 0, SpringLayout.NORTH, lblExp);
        
        cmdOk = new JButton("Ok");
        getContentPane().add(cmdOk);
        layout.putConstraint(SpringLayout.WEST, cmdOk, 30, SpringLayout.WEST, getContentPane());
        layout.putConstraint(SpringLayout.NORTH, cmdOk, 20, SpringLayout.SOUTH, lblExp);
        
        cmdCancel = new JButton("Cancel");
        getContentPane().add(cmdCancel);
        layout.putConstraint(SpringLayout.WEST, cmdCancel, 20, SpringLayout.EAST, cmdOk);
        layout.putConstraint(SpringLayout.NORTH, cmdCancel, 0, SpringLayout.NORTH, cmdOk);
        
        setSize(250, 400);
        setModal(true);
	}
	
	public void addOkActionListener(ActionListener al){
		cmdOk.addActionListener(al);
	}
	
	public void addCancelActionListener(ActionListener al){
		cmdCancel.addActionListener(al);
	}
	
	public static void main(String ar[]){
		new CardRegistrationGUI().setVisible(true);
	}

	public JRadioButton getChkCopper() {
		return chkCopper;
	}

	public JTextField getTxtCCNo() {
		return txtCCNo;
	}

	public JTextField getTxtExpDate() {
		return txtExpDate;
	}

}
